monocart-code-viewer
Feature
Install
npm i monocart-code-viewer
Usage
import { createCodeViewer } from 'monocart-code-viewer';
let codeViewer;
const report = {
content: "your source content",
coverage: {
uncoveredLines: {
'0': 'comment',
'1': 'blank',
'8': 'partial',
'9': 'uncovered'
},
uncoveredPieces: {
'8': [
{
'start': 27,
'end': 34
}
]
},
decorations: {
'14': [
{
'column': 4,
'value': 'E',
'attrs': {
'title': 'else path uncovered'
}
}
]
},
executionCounts: {
'20': [
{
'column': 22,
'count': 10,
'value': '10',
'end': 916
}
]
}
}
};
if (codeViewer) {
codeViewer.update(report);
} else {
codeViewer = createCodeViewer($el, report);
codeViewer.on('cursor', (loc) => {
});
}